import {Injectable} from '@angular/core';
import {BaseHttpService} from '../base-http.service';
import {Observable} from 'rxjs';

export interface MsdsElement {
  pureFlag: boolean;
  msdsEntprId?: number;
  id?: number;
  elementDetailDtos?: ElementsDto[];
  elementDetails: ElementsDto[]
}

export interface ElementsDto {
  cas: string;
  msdsElementId?: number;
  dangerNo: string;
  harmfulElement: string;
  harmfulMmol: string;
}

@Injectable({
  providedIn: 'root'
})
export class MsdsElementHttpService {

  constructor(public http: BaseHttpService) {
  }


  /*新增msdsElement 信息*/
  public addMsdsElement(param: MsdsElement): Observable<number> {
    return this.http.post('/msdsElement', param, {needSuccessInfo: true});
  }

  /*修改msdsElement信息*/
  public editMsdsElement(param: MsdsElement): Observable<void> {
    return this.http.put('/msdsElement', param, {needSuccessInfo: true});
  }

  /*查询msdsElement详情*/
  public getMsdsElementDetail(msdsEntprId: number): Observable<MsdsElement> {
    return this.http.get('/msdsElement/' + msdsEntprId);
  }


}
